home *** CD-ROM | disk | FTP | other *** search
-
- #include "math.h"
- #include "a_acgi.h"
-
- #define X11EX_HALFAMPLITUDE 50 //a_Half the height
- #define X11EX_PERIOD 256 //a_The width must be a multiple of 8
- #define X11EX_2PI 6.283 //a_This will force the product to be a double (see below)
- #define X11EX_IFREQ 4 //a_# is complete cycles
-
- int main()
- {
- AXBitmap xbmOut; //_Object for outputting the X11 bitmap
- ABitMatrix bmCanvas; //a_The bit canvas
-
- //a_Set the canvas size
- bmCanvas.mSetSize(256, 2* X11EX_HALFAMPLITUDE);
-
- //a_Must clear the canvas
- bmCanvas.mSetPlane();
-
- //a_Do my drawing here (your basic sine-wave)
- double dY;
- for (int iX = 0x0; iX < X11EX_PERIOD; iX++)
- {
- dY = X11EX_HALFAMPLITUDE - X11EX_HALFAMPLITUDE * cos((X11EX_2PI * iX * X11EX_IFREQ) / X11EX_PERIOD);
-
- //a_NOTE: [Y-coordinate][X-coordinate]! (C++ array/matrix is this way)
- //a_bmCanvas[a] would return ABitArray in y-coordiante {a}
- //a_Also 0,0 is at the top-left
- bmCanvas[(int)dY][iX] = 0x1;
- }
-
- xbmOut.mimeXBitmap();
- xbmOut.xbmDoBitmap(bmCanvas);
-
- return 0x1;
- }